#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>

int main()
{
    int row = 0, col = 0, i = 0, j = 0;
    scanf("%d %d", &row, &col);
    if (row > 0 && col > 0)
    {
        for (i = 1; i <= 2 * row + 1; i++)
        {
            if (i % 2 != 0)
            {
                for (j = 1; j <= col; j++)
                {
                    printf("+-");
                }
                printf("+\n");
            }
            else
            {
                for (j = 1; j <= col; j++)
                {
                    printf("| ");
                }
                printf("|\n");
            }
        }
    }

    return 0;
}